package com.web.new12306.service.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import com.mysql.fabric.xmlrpc.base.Array;
import com.web.new12306.dao.TicketDao;
import com.web.new12306.dao.UserDao;
import com.web.new12306.dao.impl.TicketDaoImpl;
import com.web.new12306.dao.impl.UserDaoImpl;
import com.web.new12306.pojo.Ticket;
import com.web.new12306.pojo.User;
import com.web.new12306.service.UserService;
import com.web.new12306.util.DaoUtil;
/**

 * @author 苗宇
 *
 */

public class UserServiceImpl implements UserService{
	/**
	 * 
	 * @anther苗宇
	 */
	@Override
	public boolean Login(String name, String pwd) {
		Connection connection=DaoUtil.getConnection();
		UserDao userDao=new UserDaoImpl();
		return userDao.Login(connection, name, pwd);
		
	}
	/**
	 * 
	 * @anther苗宇
	 */
	@Override
	public ArrayList<User> showAll() {
		// TODO Auto-generated method stub
		return null;
	}
	/**
	 * 
	 * @anther苗宇
	 */
	@Override
	public int saveUser(User user) {
		Connection connection=DaoUtil.getConnection();
		UserDao userDao=new UserDaoImpl();
		return userDao.saveUser(connection,user);
	}
	/**
	 * 
	 * @anther苗宇
	 */
	@Override
	public List<User> queryUsers(Integer pages, Integer rows) {
		Connection conn=DaoUtil.getConnection();
		UserDao userDao=new UserDaoImpl();
		List<User> list=userDao.select(conn, pages, rows);
		return list;
	}
	/**
	 * 
	 * @anther苗宇
	 */
	@Override
	public int number() {
		Connection conn=DaoUtil.getConnection();
		UserDao userDao=new UserDaoImpl();
		int number =userDao.number(conn);
		return number;
	}
	/**
	 * 
	 * @anther蔡艳
	 */
	@Override
	public User showPerson(User user) {
		Connection connection=DaoUtil.getConnection();
		UserDao userDao=new UserDaoImpl();
		return userDao.showPerson(connection, user);
	}
	/**
	 * 
	 * @anther蔡艳
	 */
	@Override
	public int updatePerson(User user) {
		Connection connection=DaoUtil.getConnection();
		UserDao userDao=new UserDaoImpl();
		return userDao.updatePerson(connection, user);
	}

	
}
